package net.xo68.destiny.core.util;

import net.xo68.destiny.contract.common.SystemConstants;

/**
 * 路径工具类
 * @author wuxie
 * @version 2020-10-29
 */
public final class PathUtils {

    private PathUtils() {
        throw new IllegalArgumentException();
    }

    /**
     * 清洗文件路径中的杂质
     *  包括：
     *  [\\.\\,/./] -> [\\,/]
     * @param path
     * @return
     */
    public static String rinsePath(String path){
        return path
                .replace(SystemConstants.PATH_REPLACE_TARGET0,SystemConstants.PATH_REPLACE_REPLACEMENT0)
                .replace(SystemConstants.PATH_REPLACE_TARGET1,SystemConstants.PATH_REPLACE_REPLACEMENT1);
    }
}
